/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package model;

/**
 *
 * @author Jerry
 */
public class Cofactor {
    
    public int [][] calculateCofactor(int [][] matrix){
        
        int n = matrix.length;
        
      int cofactor[][] = new int[n][n];
 
      for ( int i = 0 ; i < n ; i++ )
      {
         for ( int j = 0 ; j < n ; j++ )               
            cofactor[i][j] = ((-1)^(i+j)*matrix[i][j]);
      }
        return cofactor;
    }
}
